#coding=utf8
import arcpy
import json
arcpy.env.overwriteOutput = True
spRef = arcpy.SpatialReference(4490)

jsonFile = r'D:\WorkData\20250724JH\azd-json\res.json'
with open(jsonFile.decode('utf-8'), 'rb') as file:
    content = file.read().decode('utf-8')
data = json.loads(content)
point_list = []
for i in range(len(data['features'])):
    coord_x = data['features'][i]['data']['lgtd']
    coord_y = data['features'][i]['data']['lttd']
    cityName = data['features'][i]['data']['cityName']
    countyName = data['features'][i]['data']['countyName']
    plmtName = data['features'][i]['data']['plmtName']
    townName =data['features'][i]['data']['townName']
    admVlgName = data['features'][i]['data']['admVlgName']
    landArea = data['features'][i]['data']['landArea']
    plmtImg = data['features'][i]['data']['plmtImg']
    cn = [coord_x, coord_y, cityName, countyName, plmtName, townName, admVlgName, landArea]
    point_list.append(cn)
m_point = arcpy.CreateFeatureclass_management(r'D:\WorkData\20250724JH\azd-shp', 'azd_point.shp', 'POINT',spatial_reference=spRef)
arcpy.AddField_management(m_point, 'cityName', 'TEXT')
arcpy.AddField_management(m_point, 'countyName', 'TEXT')
arcpy.AddField_management(m_point, 'plmtName', 'TEXT')
arcpy.AddField_management(m_point, 'townName', 'TEXT')
arcpy.AddField_management(m_point, 'admVlgName', 'TEXT')
arcpy.AddField_management(m_point, 'landArea', 'TEXT')
arcpy.AddField_management(m_point, 'plmtImg', 'TEXT')
cs = arcpy.da.InsertCursor(m_point, ['SHAPE@X', 'SHAPE@Y','cityName','countyName','plmtName','townName','admVlgName','landArea'])
for point in point_list:
    cs.insertRow(point)
del cs